<template>
	<div>
		<div class="chooser">
		   <v-chooser  :selections="periodList"></v-chooser>	
		</div>
		<!--<mt-field label="我要留言" placeholder="请输入留言" type="textarea" rows="4" v-model="introduction">			
		</mt-field>
		<mt-button type="primary" @click="pop" style="margin-left:140px">发表留言</mt-button>-->
<div style="margin-bottom: 50px;">			
	<div v-for="item in comments" :key="item.id">
		<router-link :to="{name:'msgdetail',query:{id:item.id}}">
			<mt-cell :title="item.title|ellipsis" >
  <span>{{item.last_reply_at|ymd}}</span>
  <img slot="icon" :src="item.author.avatar_url" width="24" height="24">
</mt-cell>
</router-link>
	</div>


</div>

	</div>
</template>

<script>
import VChooser from './base/chooser'
import { Toast } from 'mint-ui';
	export default {
		name: 'MintUi',
	    components: {
          VChooser,
         },
		data() {
			return {
				selected:{
					title:'',
				},
				popupVisible:false,
//				closeOnClickModal:true
				introduction:'',
				comments:[],
				systemDate:'',
				      periodList: [
        {
          label: '全部',
          value: 0
        },
        {
          label: '精华',
          value: 1
        },
        {
          label: '分享',
          value: 2
        }
      ],
			}
		},
		methods:{
			pop(){
				Toast('发布成功');
			},
			popup(){
				this.popupVisible=true
			},
			addDate() {
                   let nowDate = new Date();
                    let date = {
                        year: nowDate.getFullYear(),
                        month: nowDate.getMonth() + 1,
                        date: nowDate.getDate(),
                    }
                   // console.log(date);
                    this.systemDate = date.year + '-'  + date.month + '-' + date.date;
                }
		},
		  created: function () {
    this.$axios.get('https://cnodejs.org/api/v1/topics')
    .then((res) => {
    this.comments = res.data.data
    // console.log(res.data)
    }, (err) => {
      console.log(err)
    });
    this.addDate();
  },
	}
</script>

<style>
.chooser{
	padding: 10px;
	background: #fff;
}
</style>